import java.util.Arrays;
import java.util.HashMap;

public class FindRelativeRanks {

    public String[] findRelativeRanks(int[] score) {
        int[] nums = Arrays.copyOf(score, score.length);
        Arrays.sort(nums);
        HashMap<Integer, String> map = new HashMap<>();
        String[] ans = new String[score.length];
        for (int i = nums.length - 1; i >= 0; i--) {
            map.put(nums[i], (nums.length - i + ""));
        }
        for (int i = 0; i < score.length; i++) {
            String s = map.get(score[i]);
            if (s.equals("1")) {
                ans[i] = "Gold Medal";
            } else if (s.equals("2")) {
                ans[i] = "Silver Medal";
            } else if (s.equals("3")) {
                ans[i] = "Bronze Medal";
            } else {
                ans[i] = s;
            }
        }
        return ans;
    }
}
